# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=mkvtoolnix
pkgver=69.0.0
pkgrel=0
pkgdesc="Set of tools to create, edit and inspect Matroska files"
url="https://mkvtoolnix.download/index.html"
# riscv64 blocked by fatal error: boost/core/use_default.hpp: No such file or directory
arch="all !riscv64"
license="GPL-2.0-only"
makedepends="boost-dev docbook-xsl file-dev flac-dev gtest-dev pcre2-dev
	libmatroska-dev libogg-dev libvorbis-dev ruby ruby-rake zlib-dev
	qt6-qtbase-dev qt6-qtmultimedia-dev qt6-qtsvg cmark-dev gmp-dev"
subpackages="$pkgname-doc $pkgname-gui"
source="https://mkvtoolnix.download/sources/mkvtoolnix-$pkgver.tar.xz"

build() {
	./configure CC="${CC:-gcc}" CFLAGS="$CFLAGS" \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--without-gettext
	rake V=1 -j$JOBS
}

check() {
	rake V=1 -j$JOBS tests:unit
	rake V=1 -j$JOBS tests:run_unit
}

package() {
	rake DESTDIR="$pkgdir" install
}

gui() {
	pkgdesc="$pkgdesc (GUI)"
	depends="$pkgname qt6-qtsvg"

	amove usr/bin/mkvtoolnix-gui
	amove usr/share
}

sha512sums="
c7ce69e9a921103da4745c75cd6fa41a49dbb8637f48097233388e5d8be121714d3fde10f745b78e84a8ef70e46f0168f36f069331f04623805c0bda8a90060c  mkvtoolnix-69.0.0.tar.xz
"
